-
-
Notifications
You must be signed in to change notification settings - Fork 771
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add test for #1796, failing to stub Array.prototype.sort #1876
Conversation
This was fixed in c2c7814
Pull Request Test Coverage Report for Build 2625
💛 - Coveralls |
test/issues/issues-test.js
Outdated
describe("#1796 - cannot stub Array.prototype.sort", function () { | ||
it("it should not fail with RangeError", function () { | ||
var stub = sinon.stub(Array.prototype, "sort"); | ||
[1, 2, 3].sort(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All tests should have assertions. Assert that this doesn't throw.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I've added an extra commit. Once happy with this PR, I'll fold the commits together
|
||
describe("#1796 - cannot stub Array.prototype.sort", function () { | ||
it("it should not fail with RangeError", function () { | ||
var stub = sinon.stub(Array.prototype, "sort"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this stub need to .callThrough()
(like the linked issue) to trigger the RangeError
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, .callThrough()
is not necessary to trigger the RangeError
.
test/issues/issues-test.js
Outdated
it("it should not fail with RangeError", function () { | ||
refute.exception(function () { | ||
var stub = sinon.stub(Array.prototype, "sort"); | ||
[1, 2, 3].sort(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be the only line that we are concerned with not throwing an exception.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, I've pushed a commit that fixes that
Dang, I merged without squashing ... |
This PR shows that the issue described in #1796 has been fixed (in c2c7814)
Once this is merged, we should create a new release.
How to verify - mandatory
npm install
npm test
Checklist for author
npm run lint
passes